package com.english.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 签到签退操作日志实体类
 *
 * @author wlq
 * @since 2025-08-08
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("attendance_log")
public class AttendanceLog {

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 学生ID
     */
    @TableField("student_id")
    private Long studentId;

    /**
     * 操作管理员ID
     */
    @TableField("admin_id")
    private Long adminId;

    /**
     * 考勤记录ID
     */
    @TableField("attendance_id")
    private Long attendanceId;

    /**
     * 操作类型
     */
    @TableField("action_type")
    private ActionType actionType;

    /**
     * 操作时间
     */
    @TableField("action_time")
    private LocalDateTime actionTime;

    /**
     * 扣除课时数
     */
    @TableField("hours_deducted")
    private Integer hoursDeducted;

    /**
     * 操作前剩余课时
     */
    @TableField("before_remaining_hours")
    private Integer beforeRemainingHours;

    /**
     * 操作后剩余课时
     */
    @TableField("after_remaining_hours")
    private Integer afterRemainingHours;

    /**
     * 备注
     */
    @TableField("notes")
    private String notes;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 操作类型枚举
     */
    public enum ActionType {
        SIGN_IN("签到"),
        SIGN_OUT("签退");

        private final String description;

        ActionType(String description) {
            this.description = description;
        }

        public String getDescription() {
            return description;
        }
    }
} 